//
//  VRCaipiaoDetailCell.m
//  VRKaiCai
//
//  Created by slh on 2017/6/23.
//  Copyright © 2017年 slh. All rights reserved.
//

#import "VRCaipiaoDetailCell.h"

#import "VRCaipiaoOpen.h"


@interface VRCaipiaoDetailCell()

@property (nonatomic, weak) UILabel *detailLbl;

@property (nonatomic, weak) UILabel *prizeNameTitleLbl;
@property (nonatomic, weak) UILabel *prizeNameLbl;

@property (nonatomic, weak) UILabel *requireTitleLbl;
@property (nonatomic, weak) UILabel *requireLbl;

@property (nonatomic, weak) UILabel *numTitleLbl;
@property (nonatomic, weak) UILabel *numLbl;

@property (nonatomic, weak) UILabel *singlebonusTitleLbl;
@property (nonatomic, weak) UILabel *singlebonusLbl;

@end

@implementation VRCaipiaoDetailCell

- (void)setModel:(VRCaipiaoOpen *)model
{
    _model = model;
    
    self.prizeNameLbl.text = model.prizename;
    self.requireLbl.text = model.require;
    self.numLbl.text = model.num;
    self.singlebonusLbl.text = model.singlebonus;
}

+ (instancetype)cellWith:(UITableView *)tableview
{
    static NSString *cellID = @"VRCaipiaoDetailCell";
    
    VRCaipiaoDetailCell *cell = [tableview dequeueReusableCellWithIdentifier:cellID];
    
    if (nil == cell) {
        cell = [[VRCaipiaoDetailCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellID];
    }
    
    return cell;
}



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.textLabel.mj_x = 30;
        self.textLabel.font = [UIFont systemFontOfSize:15];
        self.textLabel.textColor = VRColor(146, 146, 146);
        
        [self setupSubView];
    }
    return self;
}


- (void)setupSubView
{
    
//    /** 奖项 */
//    @property (nonatomic, copy) NSString *prizename;
//    /** 中奖条件 */
//    @property (nonatomic, copy) NSString *require;
//    /** 中奖人数 */
//    @property (nonatomic, copy) NSString *num;
//    /** 单注金额 */
//    @property (nonatomic, copy) NSString *singlebonus;
    UILabel *prizeNameTitleLbl = [[UILabel alloc] init];
    prizeNameTitleLbl.text = @"奖   项";
    prizeNameTitleLbl.font = [UIFont systemFontOfSize:16];
    [self.contentView addSubview:prizeNameTitleLbl];
    self.prizeNameTitleLbl = prizeNameTitleLbl;
    
    UILabel *prizeNameLbl = [[UILabel alloc] init];
    prizeNameLbl.font = [UIFont systemFontOfSize:16];
    prizeNameLbl.textColor = VRColor(146, 146, 146);
    [self.contentView addSubview:prizeNameLbl];
    self.prizeNameLbl = prizeNameLbl;
    
    // 中奖条件
    UILabel *requireTitleLbl = [[UILabel alloc] init];
    requireTitleLbl.text = @"中奖条件";
    requireTitleLbl.font = [UIFont systemFontOfSize:16];
    [self.contentView addSubview:requireTitleLbl];
    self.requireTitleLbl = requireTitleLbl;
    
    UILabel *requireLbl = [[UILabel alloc] init];
    requireLbl.font = [UIFont systemFontOfSize:16];
    requireLbl.textColor = VRColor(146, 146, 146);
    [self.contentView addSubview:requireLbl];
    self.requireLbl = requireLbl;
    
    // 中奖人数
    UILabel *numTitleLbl = [[UILabel alloc] init];
    numTitleLbl.text = @"中奖人数";
    numTitleLbl.font = [UIFont systemFontOfSize:16];
    [self.contentView addSubview:numTitleLbl];
    self.numTitleLbl = numTitleLbl;
    
    UILabel *numLbl = [[UILabel alloc] init];
    numLbl.font = [UIFont systemFontOfSize:16];
    numLbl.textColor = VRColor(146, 146, 146);
    [self.contentView addSubview:numLbl];
    self.numLbl = numLbl;
    
    // 单注金额
    UILabel *singlebonusTitleLbl = [[UILabel alloc] init];
    singlebonusTitleLbl.text = @"单注金额";
    singlebonusTitleLbl.font = [UIFont systemFontOfSize:16];
    [self.contentView addSubview:singlebonusTitleLbl];
    self.singlebonusTitleLbl = singlebonusTitleLbl;
    
    UILabel *singlebonusLbl = [[UILabel alloc] init];
    singlebonusLbl.font = [UIFont systemFontOfSize:16];
    singlebonusLbl.textColor = VRColor(146, 146, 146);
    [self.contentView addSubview:singlebonusLbl];
    self.singlebonusLbl = singlebonusLbl;
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.textLabel.mj_x = 20;
    
    [self.prizeNameTitleLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(20);
        make.top.mas_equalTo(15);
    }];
    
    [self.prizeNameLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(120);
        make.top.mas_equalTo(self.prizeNameTitleLbl);
        
    }];
    
    [self.requireTitleLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(20);
        make.top.mas_equalTo(self.prizeNameLbl.mas_bottom).offset(5);
    }];
    
    [self.requireLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(120);
        make.top.mas_equalTo(self.requireTitleLbl);
        
    }];
    
    [self.numTitleLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(20);
        make.top.mas_equalTo(self.requireTitleLbl.mas_bottom).offset(5);
    }];
    
    [self.numLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(120);
        make.top.mas_equalTo(self.numTitleLbl);
        
    }];
    
    [self.singlebonusTitleLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(20);
        make.top.mas_equalTo(self.numTitleLbl.mas_bottom).offset(5);
    }];
    
    [self.singlebonusLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(120);
        make.top.mas_equalTo(self.singlebonusTitleLbl);
        
    }];
}

@end
